package com.ztstkj.lzscale.workers

import android.content.Context
import android.util.Log
import androidx.work.Worker
import androidx.work.WorkerParameters
import com.ztstkj.lzservices.networks.NetworkUtils

class NetcheckWorker (appContext: Context, params: WorkerParameters) : Worker(appContext, params) {
    override fun doWork(): Result {
        return try {
            NetworkUtils.onLine=NetworkUtils.isConnected(this.applicationContext)
            Log.i("NetcheckWorker","网络：${NetworkUtils.onLine}")
            Result.success()
        }catch (e:Exception){
            Result.retry()
        }
    }
}